# check whether a position is in a box.
# @param { [int, int, int] } from (storage minecraft:rmr arguments.pos)
# @param { [int, int, int] } from (storage minecraft:rmr arguments.box_start)
# @param { [int, int, int] } from (storage minecraft:rmr arguments.box_end)
# @returns { bool }

#data modify storage minecraft:rmr arguments.content set value []
#data modify storage minecraft:rmr arguments.content append from entity @s Pos
#data modify storage minecraft:rmr arguments.content append from storage minecraft:rmr arguments.pos
#data modify storage minecraft:rmr arguments.content append from storage minecraft:rmr arguments.box_start
#data modify storage minecraft:rmr arguments.content append from storage minecraft:rmr arguments.box_end
#function rmr:test/console/out with storage minecraft:rmr arguments

execute store result score @s rmr.hitbox.local.start_x run data get storage minecraft:rmr arguments.box_start[0] 1000
execute store result score @s rmr.hitbox.local.end_x run data get storage minecraft:rmr arguments.box_end[0] 1000
execute store result score @s rmr.hitbox.local.pos_x run data get storage minecraft:rmr arguments.pos[0] 1000

execute if score @s rmr.hitbox.local.start_x <= @s rmr.hitbox.local.end_x unless score @s rmr.hitbox.local.pos_x >= @s rmr.hitbox.local.start_x run return 0
execute if score @s rmr.hitbox.local.start_x <= @s rmr.hitbox.local.end_x unless score @s rmr.hitbox.local.pos_x <= @s rmr.hitbox.local.end_x run return 0
execute unless score @s rmr.hitbox.local.start_x <= @s rmr.hitbox.local.end_x unless score @s rmr.hitbox.local.pos_x <= @s rmr.hitbox.local.start_x run return 0
execute unless score @s rmr.hitbox.local.start_x <= @s rmr.hitbox.local.end_x unless score @s rmr.hitbox.local.pos_x >= @s rmr.hitbox.local.end_x run return 0

execute store result score @s rmr.hitbox.local.start_y run data get storage minecraft:rmr arguments.box_start[1] 1000
execute store result score @s rmr.hitbox.local.end_y run data get storage minecraft:rmr arguments.box_end[1] 1000
execute store result score @s rmr.hitbox.local.pos_y run data get storage minecraft:rmr arguments.pos[1] 1000

execute if score @s rmr.hitbox.local.start_y <= @s rmr.hitbox.local.end_y unless score @s rmr.hitbox.local.pos_y >= @s rmr.hitbox.local.start_y run return 0
execute if score @s rmr.hitbox.local.start_y <= @s rmr.hitbox.local.end_y unless score @s rmr.hitbox.local.pos_y <= @s rmr.hitbox.local.end_y run return 0
execute unless score @s rmr.hitbox.local.start_y <= @s rmr.hitbox.local.end_y unless score @s rmr.hitbox.local.pos_y <= @s rmr.hitbox.local.start_y run return 0
execute unless score @s rmr.hitbox.local.start_y <= @s rmr.hitbox.local.end_y unless score @s rmr.hitbox.local.pos_y >= @s rmr.hitbox.local.end_y run return 0

execute store result score @s rmr.hitbox.local.start_z run data get storage minecraft:rmr arguments.box_start[2] 1000
execute store result score @s rmr.hitbox.local.end_z run data get storage minecraft:rmr arguments.box_end[2] 1000
execute store result score @s rmr.hitbox.local.pos_z run data get storage minecraft:rmr arguments.pos[2] 1000

execute if score @s rmr.hitbox.local.start_z <= @s rmr.hitbox.local.end_z unless score @s rmr.hitbox.local.pos_z >= @s rmr.hitbox.local.start_z run return 0
execute if score @s rmr.hitbox.local.start_z <= @s rmr.hitbox.local.end_z unless score @s rmr.hitbox.local.pos_z <= @s rmr.hitbox.local.end_z run return 0
execute unless score @s rmr.hitbox.local.start_z <= @s rmr.hitbox.local.end_z unless score @s rmr.hitbox.local.pos_z <= @s rmr.hitbox.local.start_z run return 0
execute unless score @s rmr.hitbox.local.start_z <= @s rmr.hitbox.local.end_z unless score @s rmr.hitbox.local.pos_z >= @s rmr.hitbox.local.end_z run return 0

return 1